// 登录-判断业务员是否登录
let isLogin = '/api-sys/manageLogin/isLogin';
// 登录-业务员获取微信用户openid
let getWechatOpenId = '/token/getOpenId';
// 登录-小程序
let loginCheck = '/token/getToken';
// 获取用户信息
let getAdminInfo = '/token/userInfo';
// 发送验证码
let sendCode = '/api-sys/adminInfo/mobileCode';
// 管理员修改手机号
let updateAdminPhone = '/api-sys/adminInfo/updateAdminPhone';
// 生成二维码
let generateQrCode = '/user/generateQrCode';

// 查询是否有未完成订单
let queryActOrder = '/api-work/rec/recOrder/queryActOrder';
// 招聘活动 分页查询
let getActivityList = '/recruit/pageQuery';
// let getActivityList = '/recruit/pageQuery';
// 查询我发布的活动 
let pageQueryByWork = '/recruit/pageQueryByWork';
// 招聘活动明细
let getActivityInfo = '/recruit/getRecruitInfo';
// 招聘活动 添加或修改
let saveOrUpdateActivity = '/recruit/saveOrUpdate';
// 招聘活动 下架
let offShelfe = '/api-work/rec/recActivity/offShelfe';
// 招聘活动 接单接口
let receiving = '/order/receiving';
// 招聘活动 到达地点
let toOrder = '/order/placeOrder';
// 订单表
let getOrderList = '/api-work/rec/recOrder/query';
// 订单明细
let getOrderInfo = '/api-work/rec/recOrder/getById';
// 招聘活动删除
let deleteActivity = '/api-work/rec/recActivity/deleteByIds';
// 活动工种管理表 分页查询
let getWorkList = '/api-work/rec/recActivityWork/pageQuery';
// 我的推荐
let getMyRecommend = '/user/queryByReco';
// 接单支付押金结果回调
let receError = '/api-work/rec/recActivity/receError';
// 发布工作支付佣金回调
let pubError = '/order/pubError';
// 预支付接口
let pay = '/pay/getPreOrder';
// 获取支付金额
let cashPledge = '/day/getDayList';
//图片保存
let saveImages = 'recruit/uploadImages';
//图片保存
let deleteImages = 'recruit/deleteImages';
let shelfReruit = 'recruit/shelfReruit' // 招聘下架
let addGroup = 'user/addGroup' // 添加社群
let addEditMobile = 'user/addEditMobile' // 添加编辑联系电话
let delMobile = 'user/delMobile' // 删除联系电话
let getNotReviewed = 'user/getNotReviewed' // 查询未审核专属代招
let bigReview = 'user/review' // 审核专属代招
let deleteExclusive = 'user/delExclusiveMembers' // 大中介删除专属小中介
let getExclusiveMembers = 'user/getExclusiveMembers' // 大中介获得所有专属代招
let myOrder = 'user/order' //生成订单
let orderSuccess = 'order/callPack' //完成订单
let recruitLogin = 'recruit/login' //抖音登入
let myRecruits = 'recruit/myRecruits' // 大中介发布管理页面


// 改进的对象
const obj = {
	applyBig: 'user/applyBig', // 申请成为大中介
	applySmall: 'user/apply', // 申请成为小中介
	getGroupMembers: 'user/getGroupMembers', // 大中介分组成员信息
	delGroup: 'user/delGroup', // 删除分组
	addGroupMenber: 'user/addGroupMembers', // 添加组成员
	delGroupMembers: 'user/delGroupMembers', // 删除组成员
	getUngroupedMembers: 'user/getUngroupedMembers', // 大中介查看未分组小中介
	minPageQuery: 'intermediaryrecruit/pageQuery', // 小中介获取公开招聘
	minPageQueryByWork: 'intermediaryrecruit/pageQueryByWork', // 小中介更多信息列表
	samllMyRecruits: 'intermediaryrecruit/myRecruits', // 小中介的我哦
	smallSaveOrUpdate: 'intermediaryrecruit/saveOrUpdate', // 小中介领取
	smallGetRecruitInfo: 'intermediaryrecruit/getRecruitInfo', // 小中介招聘详情
	fillInformation: 'intermediaryrecruit/fillInformation', // 小中介填写工人信息
	getIntermediaryRecruitInfo: 'intermediaryrecruit/getIntermediaryRecruitInfo', // 工人查看招聘详情
	changeStatus: 'recruit/changeStatus', // 大中介填写入职离职信息
	userGetCord: 'user/getQrCode', // 获取分享二维码
	bigSendSms: 'recruit/sendSms', // 大中介发送短信获取验证码
	bigLogin: 'recruit/login', // 大中介登录

}

// let getUserInfo = 'token/userInfo'
// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此处没有使用传入的params参数
	let postIsLogin = (params = {}) => vm.$u.post(isLogin, params);
	let postGetWechatOpenId = (params = {}) => vm.$u.post(getWechatOpenId, params);
	let postLoginCheck = (params = {}) => vm.$u.post(loginCheck, params);
	let postGetAdminInfo = (params = {}) => vm.$u.post(getAdminInfo, params);
	let postSendCode = (params = {}) => vm.$u.post(sendCode, params);
	let postupdateAdminPhone = (params = {}) => vm.$u.post(updateAdminPhone, params);
	let postGenerateQrCode = (params = {}) => vm.$u.post(generateQrCode, params);

	let postQueryActOrder = (params = {}) => vm.$u.post(queryActOrder, params);
	let postGetActivityList = (params = {}) => vm.$u.post(getActivityList, params);
	let postPageQueryByWork = (params = {}) => vm.$u.post(pageQueryByWork, params);
	let postGetActivityInfo = (params = {}) => vm.$u.post(getActivityInfo, params);
	let postSaveOrUpdateActivity = (params = {}) => vm.$u.post(saveOrUpdateActivity, params);
	let postOffShelfe = (params = {}) => vm.$u.post(offShelfe, params);
	let postReceiving = (params = {}) => vm.$u.post(receiving, params);
	let postOrder = (params = {}) => vm.$u.post(toOrder, params);
	let postGetOrderList = (params = {}) => vm.$u.post(getOrderList, params);
	let postGetOrderInfo = (params = {}) => vm.$u.post(getOrderInfo, params);
	let postDeleteActivity = (params = {}) => vm.$u.post(deleteActivity, params);
	let postGetWorkList = (params = {}) => vm.$u.post(getWorkList, params);
	let postGetMyRecommend = (params = {}) => vm.$u.post(getMyRecommend, params);
	let postReceError = (params = {}) => vm.$u.post(receError, params);
	let postPubError = (params = {}) => vm.$u.post(pubError, params);
	let postPay = (params = {}) => vm.$u.post(pay, params);
	let postCashPledge = (params = {}) => vm.$u.post(cashPledge, params);
	let postSaveImages = (params = {}) => vm.$u.post(saveImages, params);
	let postDeleteImages = (params = {}) => vm.$u.post(deleteImages, params);

	// 新加
	let postShelfReruit = (params = {}) => vm.$u.post(shelfReruit, params);
	let postAddGroup = (params = {}) => vm.$u.post(addGroup, params);
	let postAddEditMobile = (params = {}) => vm.$u.post(addEditMobile, params);
	let postDelMobile = (params = {}) => vm.$u.post(delMobile, params);
	let postGetNotReviewed = (params = {}) => vm.$u.post(getNotReviewed, params);
	let postBigReview = (params = {}) => vm.$u.post(bigReview, params);
	let delExclusiveMembers = (params = {}) => vm.$u.post(deleteExclusive, params);
	let postExclusiveMembers = (params = {}) => vm.$u.post(getExclusiveMembers, params);
	let postMyRecruits = (params = {}) => vm.$u.post(myRecruits, params)
	let postMyOrder = (params = {}) => vm.$u.post(myOrder, params)
	let postOrderSuccess = (params = {}) => vm.$u.post(orderSuccess, params)
	let postRecruitLogin = (params = {}) => vm.$u.post(postRecruitLogin, params)

	const arrObj = {}
	for (let key in obj) {
		arrObj[key] = (params = {}) => vm.$u.post(obj[key], params)
	}

	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		postIsLogin,
		postGetWechatOpenId,
		postLoginCheck,
		postGetAdminInfo,
		postSendCode,
		postupdateAdminPhone,
		postGenerateQrCode,

		postQueryActOrder,
		postGetActivityList,
		postPageQueryByWork,
		postGetActivityInfo,
		getActivityInfo,
		postSaveOrUpdateActivity,
		postOffShelfe,
		postReceiving,
		postOrder,
		postGetOrderList,
		postGetOrderInfo,
		postDeleteActivity,
		postGetWorkList,
		postGetMyRecommend,
		postReceError,
		postPubError,
		postPay,
		postCashPledge,
		postSaveImages,
		postDeleteImages,

		postShelfReruit,
		postAddGroup,
		postDelMobile,
		postAddEditMobile,
		postGetNotReviewed,
		postBigReview,
		delExclusiveMembers,
		postExclusiveMembers,
		postMyRecruits,
		postMyOrder,
		postOrderSuccess,
		postRecruitLogin,

		...arrObj
	};
}


export default {
	install
}
